package xiegd.com.springbootuse.demo.lazy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @Author: xieguangda
 * @Description:
 * @Date: 2023/9/15 17:00
 */
@Component
public class Father {

    @Value("我是测试啊")
    private String name;

    //@Lazy

    private Son son;

//    public Son getSon() {
//        return son;
//    }
//
    @Autowired
    public void setSon(Son son) {
        System.out.println("我又没有被地道用");
        this.son = son;
    }

    public Father() {
        System.out.println("father 实例化");
    }

    public Father(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Father{" +
                "name='" + name + '\'' +
                ", son=" + son +
                '}';
    }
}
